﻿using System;
using System.Collections.Generic;
using System.Text;
using Ghasam.Business.Domain.Entity;
using Ghasam.Business.DAO;
using Spring.Transaction.Interceptor;

namespace Ghasam.Business.Services.Impl
{
    public class SalesPersonService:ISalesPersonService
    {
        #region "Private Method"

        private ISalesPersonDao iSalesPersonDao;

        #endregion
        # region "Public Method"

        public ISalesPersonDao ISalesPersonDao
        {
            set { iSalesPersonDao = value; }
            get {return iSalesPersonDao; }
        }

       [Transaction(ReadOnly = false)]
       public void SalesPersonSaveOrUpadate(string title, string phone, string address, int balance, DateTime? createDate, DateTime? modifydate)
        {
            SalesPerson saleP = new SalesPerson();
            saleP.Title = title;
            saleP.Phone = phone;
            saleP.Address = address;
            saleP.Balance = balance;
            saleP.CreateDate = createDate;
            saleP.ModifyStamp = modifydate;
            ISalesPersonDao.SaveOrUpdate(saleP);
        }
        public IList<SalesPerson> FindAll()
        {
            IList<SalesPerson> salesPerson = ISalesPersonDao.FindAll();
            return salesPerson;
        }
        public SalesPerson FindById(int salesPersonId)
        {
            return ISalesPersonDao.FindById(salesPersonId);
        }
        #endregion

    }
}
